from DcmConfig.DcmDIDAutoConfig import *
from DcmConfig.DidInput import *
from DcmConfig.DcmCode import *

inputPath = './InputFiles/DcmConfig/'
inpputDcmRequrementFile = 'DidInfo.xlsx'

outpath = './outputFiles/DcmConfig/'
outDcmConfigFile = 'DidCfg.arxml'
outDcmCodeFile = 'Dcm_SWC_Did.c'
outNvmCodeFile = 'NvM_SWC_Did'

def main():
    DcmCfg = DcmDIDConfig()
    DidInfoList = searchDidInfo(inputPath + inpputDcmRequrementFile)
    genDcmDidCodeFile(outpath + outDcmCodeFile)

    for DidInfo in DidInfoList:
        DcmCfg.addDspDid_cfg(DidInfo)
        DcmCfg.addNvMDid_cfg(DidInfo)
        genDcmDidCode(DidInfo, outpath + outDcmCodeFile)

    genNvMDidCode(DidInfoList, outpath + outNvmCodeFile)
    DcmCfg.outputXml(outpath, outDcmConfigFile)
    
if __name__ == "__main__":
    
    main()